﻿using System;
using System.Collections.Generic;
using System.Text;
using DreamShield.Deployment.Assistants.DreamWizard;
using DreamShield.Deployment.Installers.DreamWorker;
using DreamShield.Deployment.Assistants.DreamWizard.WizardInterfaces;

namespace DreamShield.Deployment.Miles.CustomWizard
{
    /// <summary>
    /// Classe chargée d'installer un Provider dans la logique de l'assistant.
    /// </summary>
    /// <remarks>
    /// La fonction GetUIProvider est abstraite et doit être implémentée afin
    /// de créer le provider voulu
    /// </remarks>
    public abstract class MilesWizardLoader : BaseMilesPlugin
    {
        public MilesWizardLoader(MilesRootServer server)
            : base(server)
        {
            _NativePluginType = DreamWizardEngine.DreamWizardEngine_PluginGuid;
            _NativePluginImplementation = new SkinLoaderExecute(this);
        }

        protected class SkinLoaderExecute : BaseDreamWizardEngine_Plugin
        {
            public virtual MilesWizardLoader Owner { get; protected set; }

            public SkinLoaderExecute(MilesWizardLoader owner)
            {
                Owner = owner;
            }

            public override void ExecuteMode_Begin(WorkerActionId mode, bool resetEngineAfter)
            {
                base.ExecuteMode_Begin(mode, resetEngineAfter);

                Engine.WizardInterface = Owner.GetUIProvider(Engine);
            }
        }

        protected abstract IDreamWizardInterfaceProvider GetUIProvider(DreamWizardEngine Engine);
    }
}
